{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 用pytorch搭建全连接神经网络，对Fashion-MNIST数据集中的时尚物品进行分类"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 概要\n",
    "本课，你将通过业界知名的深度学习框架pytorch搭建四层全连接神经网络，分析Fashion-MNIST数据集中的六万张训练集图片和一万张测试集图片，观察训练误差和验证误差随训练代数提高的变化。\n",
    "首先搭建普通的四层全连接神经网络，训练后发现过拟合明显。\n",
    "通过Dropout方法，减少过拟合。\n",
    "你将掌握图像多分类、准确率与误差分析、搭建全连接神经网络并通过Adam算法进行梯度下降训练，最重要的是，熟悉pytorch这一简洁明快的深度学习工具。\n",
    "\n",
    "Github：[zihaopytorch](https://github.com/TommyZihao/zihaopytorch)<br>\n",
    "\n",
    "![Fashion-MNIST时尚物品数据集](https://upload-images.jianshu.io/upload_images/13714448-e0d2b1be2bb1702e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)\n",
    "\n",
    "## 作者\n",
    "\n",
    "张子豪 同济大学研究生 2019-06-06\n",
    "\n",
    "Bilibili视频教程：[同济子豪兄](https://space.bilibili.com/1900783/#/)<br>\n",
    "\n",
    "知乎专栏：[人工智能小技巧](https://zhuanlan.zhihu.com/c_1032626015746502656)<br>\n",
    "\n",
    "简书专栏：[人工智能小技巧](https://www.jianshu.com/u/38cccf09b515)<br>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 粉丝答疑交流QQ群：953712961\n",
    "\n",
    "\n",
    "# 微信赞赏码\n",
    "\n",
    "![子豪兄的赞赏码](https://upload-images.jianshu.io/upload_images/13714448-bec288cb077c7f08.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 0.安装pytorch"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 0.1下载pytorch\n",
    "打开pytorch[官网](https://pytorch.org/get-started/locally/)，选择对应操作系统、python版本、python包管理器和CUDA版本的pytorch，界面上会自动生成你需要运行的命令行。\n",
    "例如，我是Windows64位、python3.7，使用pip作为python包管理器，不需要CUDA，我的界面长这个样子\n",
    "![pytorch下载界面](https://upload-images.jianshu.io/upload_images/13714448-579e4ad805844c95.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "按界面提示，我需要在操作系统命令行中运行以下两条命令：<br>\n",
    "\n",
    "`pip3 install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl`\n",
    "\n",
    "`pip3 install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-win_amd64.whl`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 0.2验证安装成功\n",
    "\n",
    "运行下面的代码单元，如果正常就说明pytorch安装成功啦！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.1.0'"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 上面单元格的运行结果：pytorch的版本号"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1 下载Fasion-MNIST数据集"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`Fashion-MNIST`是一个替代原始的[MNIST手写数字数据集](http://yann.lecun.com/exdb/mnist/)的`另一个`图像数据集。 它是由Zalando（一家德国的时尚科技公司）旗下的[研究部门](https://research.zalando.com/)提供。其涵盖了来自10种类别的共7万个不同商品的正面图片。Fashion-MNIST的大小、格式和训练集/测试集划分与原始的MNIST完全一致。60000/10000的训练测试数据划分，28x28的灰度图片。你可以直接用它来测试你的机器学习和深度学习算法性能，且**不需要**改动任何的代码。\n",
    "\n",
    "Fashion-MNIST 数据集的[中文文档说明](https://github.com/zalandoresearch/fashion-mnist/blob/master/README.zh-CN.md)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch  # 导入pytorch\n",
    "from torch import nn, optim  # 导入神经网络与优化器对应的类\n",
    "import torch.nn.functional as F \n",
    "from torchvision import datasets, transforms ## 导入数据集与数据预处理的方法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 数据预处理：标准化图像数据，使得灰度数据在-1到+1之间\n",
    "transform = transforms.Compose([transforms.ToTensor(),transforms.Normalize((0.5,), (0.5,))])\n",
    "\n",
    "# 下载Fashion-MNIST训练集数据，并构建训练集数据载入器trainloader,每次从训练集中载入64张图片，每次载入都打乱顺序\n",
    "trainset = datasets.FashionMNIST('dataset/', download=True, train=True, transform=transform)\n",
    "trainloader = torch.utils.data.DataLoader(trainset, batch_size=64, shuffle=True)\n",
    "\n",
    "# 下载Fashion-MNIST测试集数据，并构建测试集数据载入器trainloader,每次从测试集中载入64张图片，每次载入都打乱顺序\n",
    "testset = datasets.FashionMNIST('dataset/', download=True, train=False, transform=transform)\n",
    "testloader = torch.utils.data.DataLoader(testset, batch_size=64, shuffle=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 显示图片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "这张图片对应的标签是 外套\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICA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yU0Q2icgGEanKcV+WiMhBEfmw3WXlIvKaiGyNf+1wm7Qc9e1uEfk8/thtEJFrctS3/iLyuohsFpGPROQn8ctz+tgZ/crJ45b1t/0iEgbwKYCrAOwFsBbALFVNbWH9NBGRnQAqVTXnY8IicgWAEwCeVNUx8ct+DeCwqt4Xf+Hspqp35Enf7gZwItc7N8c3lKlov7M0gOsA/D1y+NgZ/ZqJHDxuuTjyjwfwmapuV9UmAM8BmJGDfuQ9VV0N4PBpF88AsDT+/VK0PXmyztG3vKCq+1R1ffz7WgCndpbO6WNn9CsnclH8fQHsaffzXuTXlt8KYKWIrBORebnuTAd6x7dNP7V9eq8c9+d0gTs3Z9NpO0vnzWOXzI7X6ZaL4u9o9598GnKYqKrjAEwHcEv87S0lJqGdm7Olg52l80KyO16nWy6Kfy+A/u1+7gegOgf96JCqVse/HgSwHPm3+/CBU5ukxr8ezHF/vpRPOzd3tLM08uCxy6cdr3NR/GsBDBeRwSJSCOAmACty0I+vEZHi+B9iICLFAK5G/u0+vALAnPj3cwC8lMO+fEW+7Nzs2lkaOX7s8m3H65yc5BMfyngIQBjAElX9VdY70QERGYK2oz3QtrLxM7nsm4g8C2Ay2mZ9HQDwCwAvAngBwAAAuwHcqKpZ/8Obo2+T0fbW9cudm099xs5y3y4H8BaATQBi8YsXoO3zdc4eO6Nfs5CDx41n+BF5imf4EXmKxU/kKRY/kadY/ESeYvETeYrFT+QpFj+Rp1j8RJ76f4e/yDjBfcPIAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "image, label = next(iter(trainloader))\n",
    "\n",
    "# image图片中有64张图片，我们查看索引为2的图片\n",
    "imagedemo = image[3]\n",
    "imagedemolabel = label[3]\n",
    "\n",
    "imagedemo = imagedemo.reshape((28,28))\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "plt.imshow(imagedemo)\n",
    "\n",
    "labellist = ['T恤','裤子','套衫','裙子','外套','凉鞋','汗衫','运动鞋','包包','靴子']\n",
    "print(f'这张图片对应的标签是 {labellist[imagedemolabel]}')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2 打开数据集中的图片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "image, label = next(iter(trainloader))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([64, 1, 28, 28])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "image.shape"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "image包含了64张28 * 28的灰度图片，1代表单通道，也就是灰度"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([7, 0, 2, 6, 4, 5, 4, 2, 5, 1, 2, 2, 9, 8, 3, 2, 4, 3, 3, 7, 0, 7, 3, 7,\n",
       "        9, 9, 3, 0, 5, 9, 2, 6, 0, 0, 2, 7, 2, 4, 5, 2, 0, 2, 6, 2, 0, 6, 0, 9,\n",
       "        3, 5, 2, 2, 5, 5, 8, 2, 4, 0, 1, 0, 8, 4, 7, 8])"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "label"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "label包含了image里面64张图片对应的标签\n",
    "\n",
    "| 标注编号 | 描述 |\n",
    "| --- | --- |\n",
    "| 0 | T-shirt/top（T恤）|\n",
    "| 1 | Trouser（裤子）|\n",
    "| 2 | Pullover（套衫）|\n",
    "| 3 | Dress（裙子）|\n",
    "| 4 | Coat（外套）|\n",
    "| 5 | Sandal（凉鞋）|\n",
    "| 6 | Shirt（汗衫）|\n",
    "| 7 | Sneaker（运动鞋）|\n",
    "| 8 | Bag（包）|\n",
    "| 9 | Ankle boot（踝靴）|"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 打开训练集中的一张图片看看"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "imagedemo = image[2]\n",
    "imagedemolabel = label[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([1, 28, 28])"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "imagedemo.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "imagedemo = imagedemo.reshape((28,28))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([28, 28])"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "imagedemo.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor(2)"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "imagedemolabel"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "这张图片对应的标签是 套衫\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfA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G1X1b3IfxCRE5AqMn+2B8U1Mv1Pk2ETkKQA3Y3zW1yCALwL4ZwDfB3AZgF8DuFNVc//FW8rYbsb4j66/2bn5vffYOY/twwD+HcBOAPXk5vUYf39d2GtnjGsNCnjdeIUfUVC8wo8oKIafKCiGnygohp8oKIafKCiGnygohp8oKIafKKj/A+horaKsqvaUAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.imshow(imagedemo)\n",
    "\n",
    "labellist = ['T恤','裤子','套衫','裙子','外套','凉鞋','汗衫','运动鞋','包包','靴子']\n",
    "print(f'这张图片对应的标签是 {labellist[imagedemolabel]}')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 查看一张图片和标签完整的代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "这张图片对应的标签是 外套\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAFShJREFUeJzt3XuMnNV5BvDnncvO7M1er+292F4wJTaBonLp1m3jNoUQKGlSQf4AxWqRo0Q4lULVqJEKgqpQ9SJUFShRo6imuDFVQkDiKuKmIVYlJzQiLIRgbjHULLCs2fV1b7M7O5e3f+wQLWbPe8b7zcw39nl+kuXdeffbOfvtPjsz+37nHFFVEFF4EnEPgIjiwfATBYrhJwoUw08UKIafKFAMP1GgGH6iQDH8RIFi+IkClWrknbVIRrNob+RdBqHQ5z6nfauPm8ceL7aZ9X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cXvT+C5tryWwH8UESeF5EdcQ9mCb2VbdM/2D69J+bxnMy7c3MjnbSzdNOcu+XseF1rcYR/qTWpmqnlsFVVLwXwGQBfrTy9pepUtXNzoyyxs3RTWO6O17UWR/hHAAwsen8DgNEYxrEkVR2t/D8O4DE03+7DYx9sklr5fzzm8fxKM+3cvNTO0miCc9dMO17HEf7nAGwSkXNEpAXAFwA8GcM4PkJE2it/iIGItAO4Cs23+/CTALZX3t4O4IkYx/IhzbJzs2tnacR87pptx+tYLvKptDL+BUASwC5V/YeGD2IJIvJrWHi0BxZWNv5unGMTkQcBXIaFWV9jAG4H8DiAhwGcBeAdANepasP/8OYY22VYeOr6q52bP3iN3eCx/R6AHwPYD6BcuflWLLy+ju3cGePahhjOG6/wIwoUr/AjChTDTxQohp8oUAw/UaAYfqJAMfxEgWL4iQLF8BMF6v8BKvU+BMgkogQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "image, label = next(iter(trainloader))\n",
    "\n",
    "# image图片中有64张图片，我们查看索引为2的图片\n",
    "imagedemo = image[3]\n",
    "imagedemolabel = label[3]\n",
    "\n",
    "imagedemo = imagedemo.reshape((28,28))\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "plt.imshow(imagedemo)\n",
    "\n",
    "labellist = ['T恤','裤子','套衫','裙子','外套','凉鞋','汗衫','运动鞋','包包','靴子']\n",
    "print(f'这张图片对应的标签是 {labellist[imagedemolabel]}')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2 搭建并训练四层全连接神经网络\n",
    "\n",
    "神经网络的输入为28 * 28 = 784 个像素<br>\n",
    "第一个隐含层包含256个神经元<br>\n",
    "第二个隐含层包含128个神经元<br>\n",
    "第三个隐含层包含64个神经元<br>\n",
    "输出层输出10个结果，对应图片的10种分类<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![全连接神经网络](https://upload-images.jianshu.io/upload_images/13714448-c8b5fa11504798bf.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [],
   "source": [
    "from torch import nn, optim\n",
    "import torch.nn.functional as F\n",
    "\n",
    "class Classifier(nn.Module):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.fc1 = nn.Linear(784, 256)\n",
    "        self.fc2 = nn.Linear(256, 128)\n",
    "        self.fc3 = nn.Linear(128, 64)\n",
    "        self.fc4 = nn.Linear(64, 10)\n",
    "        \n",
    "    def forward(self, x):\n",
    "        # make sure input tensor is flattened\n",
    "        x = x.view(x.shape[0], -1)\n",
    "        \n",
    "        x = F.relu(self.fc1(x))\n",
    "        x = F.relu(self.fc2(x))\n",
    "        x = F.relu(self.fc3(x))\n",
    "        x = F.log_softmax(self.fc4(x), dim=1)\n",
    "        \n",
    "        return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "开始训练\n",
      "训练集学习次数: 1/15..  训练误差: 0.515..  测试误差: 0.436..  模型分类准确率: 0.844\n",
      "训练集学习次数: 2/15..  训练误差: 0.389..  测试误差: 0.395..  模型分类准确率: 0.856\n",
      "训练集学习次数: 3/15..  训练误差: 0.353..  测试误差: 0.395..  模型分类准确率: 0.858\n",
      "训练集学习次数: 4/15..  训练误差: 0.331..  测试误差: 0.395..  模型分类准确率: 0.858\n",
      "训练集学习次数: 5/15..  训练误差: 0.316..  测试误差: 0.368..  模型分类准确率: 0.874\n",
      "训练集学习次数: 6/15..  训练误差: 0.301..  测试误差: 0.364..  模型分类准确率: 0.870\n",
      "训练集学习次数: 7/15..  训练误差: 0.288..  测试误差: 0.375..  模型分类准确率: 0.867\n",
      "训练集学习次数: 8/15..  训练误差: 0.282..  测试误差: 0.380..  模型分类准确率: 0.872\n",
      "训练集学习次数: 9/15..  训练误差: 0.270..  测试误差: 0.373..  模型分类准确率: 0.876\n",
      "训练集学习次数: 10/15..  训练误差: 0.264..  测试误差: 0.380..  模型分类准确率: 0.869\n",
      "训练集学习次数: 11/15..  训练误差: 0.257..  测试误差: 0.361..  模型分类准确率: 0.884\n",
      "训练集学习次数: 12/15..  训练误差: 0.250..  测试误差: 0.379..  模型分类准确率: 0.868\n",
      "训练集学习次数: 13/15..  训练误差: 0.249..  测试误差: 0.372..  模型分类准确率: 0.873\n",
      "训练集学习次数: 14/15..  训练误差: 0.237..  测试误差: 0.347..  模型分类准确率: 0.885\n",
      "训练集学习次数: 15/15..  训练误差: 0.232..  测试误差: 0.377..  模型分类准确率: 0.884\n"
     ]
    }
   ],
   "source": [
    "# 对上面定义的Classifier类进行实例化\n",
    "model = Classifier()\n",
    "\n",
    "# 定义损失函数为负对数损失函数\n",
    "criterion = nn.NLLLoss()\n",
    "\n",
    "# 优化方法为Adam梯度下降方法，学习率为0.003\n",
    "optimizer = optim.Adam(model.parameters(), lr=0.003)\n",
    "\n",
    "# 对训练集的全部数据学习15遍，这个数字越大，训练时间越长\n",
    "epochs = 15\n",
    "\n",
    "# 将每次训练的训练误差和测试误差存储在这两个列表里，后面绘制误差变化折线图用\n",
    "train_losses, test_losses = [], []\n",
    "\n",
    "print('开始训练')\n",
    "for e in range(epochs):\n",
    "    running_loss = 0\n",
    "    \n",
    "    # 对训练集中的所有图片都过一遍\n",
    "    for images, labels in trainloader:\n",
    "        # 将优化器中的求导结果都设为0，否则会在每次反向传播之后叠加之前的\n",
    "        optimizer.zero_grad()\n",
    "        \n",
    "        # 对64张图片进行推断，计算损失函数，反向传播优化权重，将损失求和\n",
    "        log_ps = model(images)\n",
    "        loss = criterion(log_ps, labels)\n",
    "        loss.backward()\n",
    "        optimizer.step()\n",
    "        running_loss += loss.item()\n",
    "    \n",
    "    # 每次学完一遍数据集，都进行以下测试操作\n",
    "    else:\n",
    "        test_loss = 0\n",
    "        accuracy = 0\n",
    "        # 测试的时候不需要开自动求导和反向传播\n",
    "        with torch.no_grad():\n",
    "            # 关闭Dropout\n",
    "            model.eval()\n",
    "            \n",
    "            # 对测试集中的所有图片都过一遍\n",
    "            for images, labels in testloader:\n",
    "                # 对传入的测试集图片进行正向推断、计算损失，accuracy为测试集一万张图片中模型预测正确率\n",
    "                log_ps = model(images)\n",
    "                test_loss += criterion(log_ps, labels)\n",
    "                ps = torch.exp(log_ps)\n",
    "                top_p, top_class = ps.topk(1, dim=1)\n",
    "                equals = top_class == labels.view(*top_class.shape)\n",
    "                \n",
    "                # 等号右边为每一批64张测试图片中预测正确的占比\n",
    "                accuracy += torch.mean(equals.type(torch.FloatTensor))\n",
    "        # 恢复Dropout\n",
    "        model.train()\n",
    "        # 将训练误差和测试误差存在两个列表里，后面绘制误差变化折线图用\n",
    "        train_losses.append(running_loss/len(trainloader))\n",
    "        test_losses.append(test_loss/len(testloader))\n",
    "\n",
    "        print(\"训练集学习次数: {}/{}.. \".format(e+1, epochs),\n",
    "              \"训练误差: {:.3f}.. \".format(running_loss/len(trainloader)),\n",
    "              \"测试误差: {:.3f}.. \".format(test_loss/len(testloader)),\n",
    "              \"模型分类准确率: {:.3f}\".format(accuracy/len(testloader)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3 验证模型效果"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 绘制训练误差和测试误差随学习次数增加的变化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x2b86bcec4e0>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl8VNX5+PHPk50sZGdLCEmQLQkBQoQoKiCooBUQUUGtu3zdba3fiq2tFdtvrfqzuNeloq0IVRbFlbqgqMgW9lXWkEmAQCBhSUK28/vjTkKAkAzZZnver9e8MvfOvXeemSTPOfecc88VYwxKKaW8g4+zA1BKKdV2NOkrpZQX0aSvlFJeRJO+Ukp5EU36SinlRTTpK6WUF9Gkr5RSXkSTvlJKeRFN+kop5UX8nB3AqWJiYkxiYqKzw1BKKbeSnZ19wBgT29h2Lpf0ExMTWbFihbPDUEoptyIiOY5sp807SinlRTTpK6WUF9Gkr5RSXsTl2vSVUm2roqICm81GWVmZs0NRDggKCiI+Ph5/f/8m7a9JXykvZ7PZCAsLIzExERFxdjiqAcYYCgsLsdlsJCUlNekY2ryjlJcrKysjOjpaE74bEBGio6ObdVamSV8ppQnfjTT3d+UxSb+opJznv9rK+rxiZ4eilFIuy2OSvq+P8PzXP/PfjfucHYpS6iwUFhbSv39/+vfvT6dOnYiLi6tdLi8vd+gYt956K1u2bGlwm5dffpkZM2a0RMhccMEFrF69ukWO1dY8piM3LMiftLhwlu4odHYoSqmzEB0dXZtA//SnPxEaGsrDDz980jbGGIwx+PjUX0+dPn16o+9z7733Nj9YD+AxNX2AwUlRrMotoqyiytmhKKWaadu2baSlpXHXXXeRkZHBnj17mDx5MpmZmaSmpjJ16tTabWtq3pWVlURERDBlyhT69evHeeedR0FBAQCPPfYY06ZNq91+ypQpDBo0iF69erF48WIAjh07xtVXX02/fv2YNGkSmZmZjdbo3333Xfr27UtaWhq/+93vAKisrOSXv/x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VuM+nwN51LXvMTn1h9FNnfDk6OppBgwbxxRdfMHbsWGbNmsV1112HiBAUFMS8efNo3749Bw4cICsrizFjxpzxPrGvvvoqwcHBrF27lrVr1540NfJf/vIXoqKiqKqqYsSIEaxdu5YHHniA5557joULFxITE3PSsbKzs5k+fTpLly7FGMPgwYMZOnQokZGRbN26lZkzZ/LGG29w7bXXMmfOnAbnx7/pppt48cUXGTp0KH/84x954oknmDZtGk899RQ7d+4kMDCwtknp2Wef5eWXX2bIkCEcPXqUoKCgs/m2G+XRmXBwchTHyqtY38LzgyulWlbdJp66TTvGGH73u9+Rnp7OyJEjycvLY9++M98SddGiRbXJNz09nfT09NrX3n//fTIyMhgwYAAbNmxodDK1H374gauuuoqQkBBCQ0MZP34833//PQBJSUn0798faHj6ZrDm9y8qKmLo0KEA3HzzzSxatKg2xhtuuIF333239srfIUOG8NBDD/HCCy9QVFTU4lcEe3RNf3CSdSOVpTsK6d/Vc9volGoxDdTIW9O4ceN46KGHWLlyJaWlpbU19BkzZrB//36ys7Px9/cnMTGx3umU66rvLGDnzp08++yzLF++nMjISG655ZZGj9PQvGQ10zKDNTVzY807Z/Lpp5+yaNEi5s+fz5NPPsmGDRuYMmUKV1xxBZ999hlZWVl89dVX9O7du0nHr49H1/RjwwLpHhui7fpKubjQ0FCGDRvGbbfddlIHbnFxMR06dMDf35+FCxeSk5PT4HEuuuii2pufr1+/nrVr1wLWtMwhISGEh4ezb98+Pv/889p9wsLC6m03v+iii/jwww8pKSnh2LFjzJs3jwsvvPCsP1t4eDiRkZG1Zwn//ve/GTp0KNXV1eTm5jJ8+HCefvppioqKOHr0KNu3b6dv37488sgjZGZmsnnz5kbe4ex4dE0frKGbH6/Op6ra4OtTfzugUsr5Jk2axPjx408ayXPDDTdw5ZVXkpmZSf/+/Rut8d59993ceuutpKen079/fwYNGgRYd8EaMGAAqampp03LPHnyZEaPHk3nzp1ZuHBh7fqMjAxuueWW2mPccccdDBgwoMGmnDN55513uOuuuygpKSE5OZnp06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8bmQ2sBNZh/T+61NWjIjIT+AnoJSI2EbkdeAq4RES2Yo0yecqZMdY4Q6wvAWHAl/b/s384Ncg6zhBv67+va5/tKKWUakkeUdNXSinlGE36SinlRTTpK6WUF9Gkr5RSXkSTvlJKeRFN+kop5UU06SullBfRpK+UUl7k/wMUYRDQSE9+WAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(train_losses, label='Training loss')\n",
    "plt.plot(test_losses, label='Validation loss')\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看到，虽然训练误差一直在下降，但测试误差居高不下，我们的神经网络仿佛一个高分低能的同学，平时把所有课后题答案都死记硬背下来，一到考试见到新题的时候就不会做了。\n",
    "\n",
    "虽然高分低能，但大部分时候依旧能做出正确判断，但是有时候预测概率只有百分之三四十的把握，不能做到十有八九的确定。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "神经网络猜测图片里是 套衫，概率为49.677035212516785%\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAFOhJREFUeJzt3X9s3OV9B/D35852HDuGxLFjgpOQH82glI4wTKCkP0CIDjY0YBUIVlgmEGGidC1tN1g0qUxaJTZRKKKlmykZYS0UWhqgHSq/W2BQSoAUAqEEgiGJQxIISRwbx+e7z/7wpXLB3/dz8f10nvdLQrHv4+fu4ey3v3d+fpm7Q0Tik6p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Bk5sr6UMnS9fMczeeE69LrRrhH2uLoVoaclji7n8G4HQAX8q/vJXCFHRyc6WMcbJ0TRjvidelVo3wbwIweoOzWQB6q9CPMbl7b/7fbQBWofZOH96675DU/L/bqtyfP6ilk5vHOlkaNfDc1dKJ19UI/7MAFprZPDNrAHAegPuq0I+PMLPm/B9iYGbNAD6P2jt9+D4AS/MfLwVwbxX78kdq5eTmpJOlUeXnrtZOvK7KJJ/8UMZ3AKQBrHD3b1W8E2Mws/kYudoDI4eY3l7NvpnZHQBOwsiqr60AvgngHgB3AZgD4G0A57h7xf/wltC3kzDy0vUPJzfve49d4b59GsATAF4CkMvfvBwj76+r9tyRfp2PKjxvmuEnEinN8BOJlMIvEimFXyRSCr9IpBR+kUgp/CKRUvhFIqXwi0Tq/wEjRwPLkpwaEAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "dataiter = iter(testloader)\n",
    "images, labels = dataiter.next()\n",
    "img = images[0]\n",
    "img = img.reshape((28,28)).numpy()\n",
    "plt.imshow(img)\n",
    "\n",
    "# 将测试图片转为一维的列向量\n",
    "img = torch.from_numpy(img)\n",
    "img = img.view(1, 784)\n",
    "\n",
    "# 进行正向推断，预测图片所在的类别\n",
    "with torch.no_grad():\n",
    "    output = model.forward(img)\n",
    "ps = torch.exp(output)\n",
    "\n",
    "top_p, top_class = ps.topk(1, dim=1)\n",
    "labellist = ['T恤','裤子','套衫','裙子','外套','凉鞋','汗衫','运动鞋','包包','靴子']\n",
    "prediction = labellist[top_class]\n",
    "probability = float(top_p)\n",
    "print(f'神经网络猜测图片里是 {prediction}，概率为{probability*100}%')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 4 采用Dropout方法防止过拟合"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "我们可以采用Dropout的方法，也就是在每次正向推断训练神经元的时候随机“掐死”一部分神经元，阻断其输入输出，这样可以起到正则化的作用。\n",
    "\n",
    "可以理解为，皇上雨露均沾，今天受宠，明天可能就被打入冷宫，这样就防止了杨贵妃那样的“三千宠爱在一身”，从而防止了某些神经元一家独大，成为话题领袖，只手遮天。\n",
    "\n",
    "所有神经元处于平等地位，防止过拟合。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Classifier(nn.Module):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "        self.fc1 = nn.Linear(784, 256)\n",
    "        self.fc2 = nn.Linear(256, 128)\n",
    "        self.fc3 = nn.Linear(128, 64)\n",
    "        self.fc4 = nn.Linear(64, 10)\n",
    "        \n",
    "        # 构造Dropout方法，在每次训练过程中都随机“掐死”百分之二十的神经元，防止过拟合。\n",
    "        self.dropout = nn.Dropout(p=0.2)\n",
    "        \n",
    "    def forward(self, x):\n",
    "        # 确保输入的tensor是展开的单列数据，把每张图片的通道、长度、宽度三个维度都压缩为一列\n",
    "        x = x.view(x.shape[0], -1)\n",
    "        \n",
    "        # 在训练过程中对隐含层神经元的正向推断使用Dropout方法\n",
    "        x = self.dropout(F.relu(self.fc1(x)))\n",
    "        x = self.dropout(F.relu(self.fc2(x)))\n",
    "        x = self.dropout(F.relu(self.fc3(x)))\n",
    "        \n",
    "        # 在输出单元不需要使用Dropout方法\n",
    "        x = F.log_softmax(self.fc4(x), dim=1)\n",
    "        \n",
    "        return x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "开始训练\n",
      "训练集学习次数: 1/15..  训练误差: 0.604..  测试误差: 0.488..  模型分类准确率: 0.821\n",
      "训练集学习次数: 2/15..  训练误差: 0.480..  测试误差: 0.439..  模型分类准确率: 0.844\n",
      "训练集学习次数: 3/15..  训练误差: 0.449..  测试误差: 0.422..  模型分类准确率: 0.848\n",
      "训练集学习次数: 4/15..  训练误差: 0.428..  测试误差: 0.424..  模型分类准确率: 0.852\n",
      "训练集学习次数: 5/15..  训练误差: 0.425..  测试误差: 0.406..  模型分类准确率: 0.850\n",
      "训练集学习次数: 6/15..  训练误差: 0.409..  测试误差: 0.392..  模型分类准确率: 0.862\n",
      "训练集学习次数: 7/15..  训练误差: 0.403..  测试误差: 0.395..  模型分类准确率: 0.857\n",
      "训练集学习次数: 8/15..  训练误差: 0.399..  测试误差: 0.388..  模型分类准确率: 0.863\n",
      "训练集学习次数: 9/15..  训练误差: 0.394..  测试误差: 0.381..  模型分类准确率: 0.866\n",
      "训练集学习次数: 10/15..  训练误差: 0.386..  测试误差: 0.387..  模型分类准确率: 0.865\n",
      "训练集学习次数: 11/15..  训练误差: 0.384..  测试误差: 0.407..  模型分类准确率: 0.857\n",
      "训练集学习次数: 12/15..  训练误差: 0.377..  测试误差: 0.392..  模型分类准确率: 0.862\n",
      "训练集学习次数: 13/15..  训练误差: 0.368..  测试误差: 0.386..  模型分类准确率: 0.871\n",
      "训练集学习次数: 14/15..  训练误差: 0.375..  测试误差: 0.391..  模型分类准确率: 0.869\n",
      "训练集学习次数: 15/15..  训练误差: 0.373..  测试误差: 0.390..  模型分类准确率: 0.867\n"
     ]
    }
   ],
   "source": [
    "# 对上面定义的Classifier类进行实例化\n",
    "model = Classifier()\n",
    "\n",
    "# 定义损失函数为负对数损失函数\n",
    "criterion = nn.NLLLoss()\n",
    "\n",
    "# 优化方法为Adam梯度下降方法，学习率为0.003\n",
    "optimizer = optim.Adam(model.parameters(), lr=0.003)\n",
    "\n",
    "# 对训练集的全部数据学习15遍，这个数字越大，训练时间越长\n",
    "epochs = 15\n",
    "\n",
    "# 将每次训练的训练误差和测试误差存储在这两个列表里，后面绘制误差变化折线图用\n",
    "train_losses, test_losses = [], []\n",
    "\n",
    "print('开始训练')\n",
    "for e in range(epochs):\n",
    "    running_loss = 0\n",
    "    \n",
    "    # 对训练集中的所有图片都过一遍\n",
    "    for images, labels in trainloader:\n",
    "        # 将优化器中的求导结果都设为0，否则会在每次反向传播之后叠加之前的\n",
    "        optimizer.zero_grad()\n",
    "        \n",
    "        # 对64张图片进行推断，计算损失函数，反向传播优化权重，将损失求和\n",
    "        log_ps = model(images)\n",
    "        loss = criterion(log_ps, labels)\n",
    "        loss.backward()\n",
    "        optimizer.step()\n",
    "        running_loss += loss.item()\n",
    "    \n",
    "    # 每次学完一遍数据集，都进行以下测试操作\n",
    "    else:\n",
    "        test_loss = 0\n",
    "        accuracy = 0\n",
    "        # 测试的时候不需要开自动求导和反向传播\n",
    "        with torch.no_grad():\n",
    "            # 关闭Dropout\n",
    "            model.eval()\n",
    "            \n",
    "            # 对测试集中的所有图片都过一遍\n",
    "            for images, labels in testloader:\n",
    "                # 对传入的测试集图片进行正向推断、计算损失，accuracy为测试集一万张图片中模型预测正确率\n",
    "                log_ps = model(images)\n",
    "                test_loss += criterion(log_ps, labels)\n",
    "                ps = torch.exp(log_ps)\n",
    "                top_p, top_class = ps.topk(1, dim=1)\n",
    "                equals = top_class == labels.view(*top_class.shape)\n",
    "                \n",
    "                # 等号右边为每一批64张测试图片中预测正确的占比\n",
    "                accuracy += torch.mean(equals.type(torch.FloatTensor))\n",
    "        # 恢复Dropout\n",
    "        model.train()\n",
    "        # 将训练误差和测试误差存在两个列表里，后面绘制误差变化折线图用\n",
    "        train_losses.append(running_loss/len(trainloader))\n",
    "        test_losses.append(test_loss/len(testloader))\n",
    "\n",
    "        print(\"训练集学习次数: {}/{}.. \".format(e+1, epochs),\n",
    "              \"训练误差: {:.3f}.. \".format(running_loss/len(trainloader)),\n",
    "              \"测试误差: {:.3f}.. \".format(test_loss/len(testloader)),\n",
    "              \"模型分类准确率: {:.3f}\".format(accuracy/len(testloader)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x2b86bd106a0>"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xl8VOXZ//HPlZ3sIQshCwRkT0hICAiCAi6IWnGvorjV6qOt1Wrbp7i1SmuLy6OoxVrbSm1dqD9XalXcUAQVWWRHCDshJCSB7AnJZO7fH2cSAmYjmclMZq736zWvzHLmnCss33POfc5932KMQSmllG/wc3cBSimleo6GvlJK+RANfaWU8iEa+kop5UM09JVSyodo6CullA/R0FdKKR+ioa+UUj5EQ18ppXxIgLsLOFFcXJxJS0tzdxlKKdWrrFmzpsQYE9/Rch4X+mlpaaxevdrdZSilVK8iIns7s5w27yillA/R0FdKKR+ioa+UUj7E49r0lVI9q6Ghgfz8fOrq6txdiuqEkJAQUlJSCAwM7NL3NfSV8nH5+flERESQlpaGiLi7HNUOYwylpaXk5+czaNCgLq1Dm3eU8nF1dXXExsZq4PcCIkJsbGy3zso09JVSGvi9SHf/rrwm9Mtq6nn6kzw25pe7uxSllPJYnQp9EZkhIttEZIeIzGljmR+KyBYR2Swir7R4/3oRyXM8rndW4Sfy8xOe/Hg7S7cdctUmlFIuUFpaypgxYxgzZgyJiYkkJyc3v66vr+/UOm688Ua2bdvW7jILFizg5ZdfdkbJTJ48mXXr1jllXT2twwu5IuIPLADOAfKBVSKy2BizpcUyQ4F7gEnGmCMikuB4vy/wWyAXMMAax3ePOPsXiQwJZHBcGBvyy5y9aqWUC8XGxjYH6IMPPkh4eDi//OUvj1vGGIMxBj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u4ciRI83bHzVqFJmZmc0DvX3++efNk8hkZ2dTWenca5Ned59+k8yUaOwGNhdUMC6tr7vLUap3eH8OFG507joTR8N589r8ODY2lvHjx/PBBx9w0UUXsWjRIq688kpEhJCQEN566y0iIyMpKSlhwoQJzJw5s815Yv/85z8TGhrKhg0b2LBhw3FDIz/88MP07duXxsZGzjrrLDZs2MAdd9zBE088wdKlS4mLiztuXWvWrGHhwoWsXLkSYwynnnoqU6ZMISYmhry8PF599VX++te/8sMf/pA33nij3fHxr7vuOp555hmmTJnCb37zGx566CHmz5/PvHnz2L17N8HBwc1NSo8//jgLFixg0qRJVFVVERIScjJ/2h3y2iP9pp65OviaUp6vZRNPy6YdYwz33nsvmZmZnH322Rw4cICioqI217Ns2bLm8M3MzCQzM7P5s9dee42cnByys7PZvHlzh4OpLV++nEsuuYSwsDDCw8O59NJL+eKLLwAYNGgQY8aMAdofvhms8f3LysqYMmUKANdffz3Lli1rrvGaa67hpZdeau75O2nSJO6++26efvppysrKnN4j2GuP9BMiQkiKCmG9TpSuVOe1c0TuShdffDF33303a9eupba2tvkI/eWXX6a4uJg1a9YQGBhIWlpaq8Mpt9TaWcDu3bt5/PHHWbVqFTExMdxwww0drqe9ccmahmUGa2jmjpp32vLf//6XZcuWsXjxYn73u9+xefNm5syZwwUXXMB7773HhAkT+PjjjxkxYkSX1t8arz3SB6uJRydUUcrzhYeHM3XqVH70ox8ddwG3vLychIQEAgMDWbp0KXv37m13PWeccUbz5OebNm1iw4YNgDUsc1hYGFFRURQVFfH+++83fyciIqLVdvMzzjiDt99+m5qaGqqrq3nrrbc4/fTTT/p3i4qKIiYmpvks4V//+hdTpkzBbrezf/9+pk2bxqOPPkpZWRlVVVXs3LmT0aNH8+tf/5rc3Fy+++67k95me7z2SB+sJp4PNhdSVlNPdGhQx19QSrnNrFmzuPTSS4+7k+eaa67hwgsvJDc3lzFjxnR4xHvbbbdx4403kpmZyZgxYxg/fjxgzYKVnZ1Nenr694ZlvuWWWzjvvPPo378/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OGCMWe+qbXhL6Lc227HH35YkIuHAG8DPjTEV7q6nNSLyA+CQMWaNu2vppAAgB/izMSYbqMZzmh+O42gLvwgYBCQBYSIy271VeScRuQ+rWfVld9fSFhEJBe4DfuPK7XhL6OcDqS1ep+Bhp8knEpFArMB/2RjzprvracckYKaI7MFqNjtTRF5yb0ntygfyjTFNZ06vY+0EPNHZwG5jTLExpgF4EzjNzTV1RpGI9Adw/Dzk5nraJSLXAz8ArjGefY/6KVgHAOsd/99SgLUikujMjXhL6K8ChorIIBEJwroYttjNNbVJRASrzXmrMeYJd9fTHmPMPcaYFGNMGtaf66fGGI89GjXGFAL7RWS4462zgC1uLKk9+4AJIhLq+DdxFh560fkEi4HrHc+vB95xYy3tEpEZwK+BmcaYGnfX0x5jzEZjTIIxJs3x/y0fyHH8m3Yarwh9x4Wa24ElWP9pXjPGbHZvVe2aBFyLddS8zvE4391FeZGfAS+LyAZgDPAHN9fTKsfZyOvAWmAj1v9Hj+o9KiKvAl8Bw0UkX0RuAuYB54hIHtZdJvPcWWOTNmr9ExABfOT4f/acW4tsoY16Xb9dzz7bUUop5UxecaSvlFKqczT0lVLKh2joK6WUD9HQV0opH6Khr5RSPkRDXymlfIiGvlJK+RANfaWU8iH/HxJtXgFLbEVAAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(train_losses, label='Training loss')\n",
    "plt.plot(test_losses, label='Validation loss')\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以看到，训练误差和测试误差都随学习次数增加逐渐降低，没有出现“高分低能”和“死记硬背”的过拟合现象，这其实是Dropout正则化的功劳。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "神经网络猜测图片里是 套衫，概率为99.89591240882874%\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAFJVJREFUeJzt3Vts3PWVB/DvmfHY41uCc7FjnJBAFCgpu02RN8su7C5dRBdWXQW0ApEHFFaI9KFIW6kPi3gpLyuhammXh1W16ZIlrFpaqpaSlRCUjVYFpApiroGmEAgOceLETkx8je25nH3wBLng3/mZufxnsuf7kVDsOfOfOf4PZ/4en99FVBVE5E+q3gkQUX2w+ImcYvETOcXiJ3KKxU/kFIufyCkWP5FTLH4ip1j8RE41JflkzdKiWbQn+ZT/L0hLsxmfXRd+GTOTYh6bGpsuK6dP2Q+P/Nrw611osY/Nnpw141oo2A/g0CymMa9zkVdlQUXFLyK3AHgUQBrAf6jqw9b9s2jHn8pNlTxl/YhxPms8RDq98QozfviBVcFY7wv2S9z51EH7yYt2gUmT/fin7toejE1uLprHXvXQYTNeODduxitivd5AzV/zcr2iB5Z937J/7ReRNIB/A3ArgK0AdorI1nIfj4iSVcln/u0APlDVo6o6D+CnAHZUJy0iqrVKir8PwPFF3w+VbvsDIrJbRAZEZCCHuQqejoiqqZLiX+pD0ec+CKnqHlXtV9X+DCJ/4SGixFRS/EMANiz6fj2Ak5WlQ0RJqaT4DwLYIiKXi0gzgLsA7K9OWkRUa2W3+lQ1LyL3A3geC62+var6btUyazQVtHaaNl1mxo/dtd6MT19l/60kfTb8Mg7/Tc48tuVe+7n72u122uBEuM0IAOOD+WBs7W/T5rEn7vmyGW+esF+T7gNDwVj+2PFgDEDDtvKqqaI+v6o+C+DZKuVCRAni8F4ip1j8RE6x+ImcYvETOcXiJ3KKxU/klCS5Y88KWaUX65RevX5bMHb09qx5bHGN3WuXcxkz3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Mi8s6i21aJyAsicqT075LbpNUpt4dE5ETp3L0pIn9bp9w2iMj/ishhEXlXRP6xdHtdz52RV13OW+K/9otIGsD7AG4GMATgIICdqvq7RBMJEJFBAP2qWveesIj8JYApAE+o6jWl274HYExVHy69cXap6j81SG4PAZiq987NpQ1lehfvLA3gNgD3oI7nzsjrTtThvNXjyr8dwAeqelRV5wH8FMCOOuTR8FT1RQBjn7l5B4B9pa/3YeF/nsQFcmsIqjqsqq+Xvp4EcGFn6bqeOyOvuqhH8fcBOL7o+yE01pbfCuDXIvKaiOyudzJL6Cltm35h+/TuOufzWdGdm5P0mZ2lG+bclbPjdbXVo/iXWrOqkVoO16vqtQBuBfCt0q+3tDzL2rk5KUvsLN0Qyt3xutrqUfxDADYs+n49gIbZ2ExVT5b+HQHwNBpv9+HTFzZJLf07Uud8PtVIOzcvtbM0GuDcNdKO1/Uo/oMAtojI5SLSDOAuAPvrkMfniEh76Q8xEJF2AF9H4+0+vB/ArtLXuwA8U8dc/kCj7Nwc2lkadT53jbbjdV0G+ZRaGf8KIA1gr6r+c+JJLEFErsDC1R5YWNn4J/XMTUSeBHAjFmZ9nQbwXQC/AvAUgMsAfAzgDlVN/A9vgdxuxMKvrp/u3HzhM3bCud0A4CUAhwAUSzc/iIXP13U7d0ZeO1GH88YRfkROcYQfkVMsfiKnWPxETrH4iZxi8RM5xeIncorFT+QUi5/Iqf8DTz/ciOGXhMUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "model.eval()\n",
    "dataiter = iter(testloader)\n",
    "images, labels = dataiter.next()\n",
    "img = images[0]\n",
    "img = img.reshape((28,28)).numpy()\n",
    "plt.imshow(img)\n",
    "\n",
    "# 将测试图片转为一维的列向量\n",
    "img = torch.from_numpy(img)\n",
    "img = img.view(1, 784)\n",
    "\n",
    "# 进行正向推断，预测图片所在的类别\n",
    "with torch.no_grad():\n",
    "    output = model.forward(img)\n",
    "ps = torch.exp(output)\n",
    "\n",
    "top_p, top_class = ps.topk(1, dim=1)\n",
    "labellist = ['T恤','裤子','套衫','裙子','外套','凉鞋','汗衫','运动鞋','包包','靴子']\n",
    "prediction = labellist[top_class]\n",
    "probability = float(top_p)\n",
    "print(f'神经网络猜测图片里是 {prediction}，概率为{probability*100}%')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
